<template>
	<view class="content">
		<view class="list">
			<view class="card" v-for="(item,index) in list" :key="index" @click="godetial(item.id)">
				<view class="pic">
					<img :src="item.prizesImage" alt="">
				</view>
				<view class="name">奖品：{{item.prizesName}}</view>
				<view class="name">中奖时间：{{item.createTime}}</view>
				<!-- <view class="other">
					<view class="name">
						<u-button v-if="item.claimMethods==0" type="error" @click="godetial(item.id)">填写邮寄地址</u-button>
					</view>
				</view> -->
				<button>点击查看</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				navId: 0,
				list: [],
			}
		},
		created() {
			this.getlist(0)
		},
		onShow() {
			this.getlist(0)
		},
		onLoad() {

		},
		methods: {

			getlist(id) {
				this.$api.request({
					url: this.$api.getprizerlist
				}).then((res) => {
					console.log(res, '中奖记录');
					this.list = res.rows
					console.log(this.list);
				})
			},

			godetial(pid) {
				console.log(pid);
				uni.navigateTo({
					url: '/myPage/prize_com/components/prizedetial?prizeid=' + pid
				})
			}

		},
	}
</script>

<style lang="less" scoped>
	.content {
		width: 100vw;
		height: 100vh;
		// padding: 5vh 0;
		background: linear-gradient(to bottom, red, orange);

		.list {
			width: 94%;
			height: 90vh;
			margin: 0 auto;
			overflow: scroll;
			border-radius: 30rpx;

			.card {
				margin: 30rpx 0;
				width: 100%;
				height: 40vh;
				background-color: #fff;
				border-radius: 30rpx;
				overflow: hidden;
				position: relative;

				.pic {
					width: 100%;
					height: 25vh;

					img {
						padding: 2%;
						width: 96%;
						height: 96%;
					}
				}

				.name {
					width: 100%;
					padding: 0 3%;
					height: 8vh;
					line-height: 8vh;
					font-size: 36rpx;
					border-top: 1rpx solid #ccc;
				}

				button {
					position: absolute;
					background-color: red;
					color: #fff;
					right: 0;
					bottom: 70rpx;
					border-radius: 40rpx 0 0 40rpx;
				}

				.other {
					width: 100%;
					height: 7vh;
					display: flex;
					flex-direction: row;
					justify-content: space-between;

					.name {
						flex: 1;
						width: 50%;
						height: 7vh;
						line-height: 7vh;
						font-size: 30rpx;
					}

					.btn {
						width: 26%;
						height: 5vh;
						margin: 1vh auto;
						line-height: 5vh;
						text-align: center;
						background-color: red;
						border-radius: 2vh 0 0 2vh;
						color: #fff;
					}
				}
			}
		}

		.list::-webkit-scrollbar {
			display: none;
			/* 隐藏滚动条 */
		}
	}
</style>